package com.wwmz.decorator.pattern.log;

import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger;

/**
 * Created by wumz on 2020/9/19 21:48
 */
public class JsonLogger extends DecoratorLogger {

    public JsonLogger(Logger logger) {
        super(logger);
    }

    @Override
    public void info(String s) {
        JSONObject result = newJsonObject();
        result.put("info message",s);
        logger.info(result.toString());
    }

    @Override
    public void error(String s) {
        JSONObject result = newJsonObject();
        result.put("error message",s);
        logger.error(result.toString());
    }

    private JSONObject newJsonObject(){
        return new JSONObject();
    }
}
